var vm = new Vue({
    el:'#app',
    data:{
        host:'http://127.0.0.1:8000/',
        navinfo:[],
        zhang_name:[],
        detail_name:[],
        new_name:''
    },
    mounted:function(){
        this.fic()

        this.fic_id = this.get_query_string('fic_id');
        this.zhangjie()
        this.detail_fic()



    },
    methods:{
         get_query_string: function(name){
            var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
            var r = window.location.search.substr(1).match(reg);
            if (r != null) {
                return decodeURI(r[2])
            }
                return null;
        },



         fic:function () {
            axios.get(this.host+'nav/',{

            }).then(response=>{
                this.navinfo=response.data

            }).catch(error=>{

            })
        },
        zhangjie:function () {
            axios.get(this.host+'zhangjie/'+this.fic_id,{

            }).then(response=>{
                this.zhang_name = response.data

                this.new_name = response.data.slice(-1)[0]
            }).catch(error=>{

            })
        },
        detail_fic:function () {
            axios.get(this.host+"Ficdetail/"+this.fic_id,{

            }).then(response=>{
                this.detail_name=response.data

            }).catch(error=>{

            })
        },
        detail_text:function (detail) {
            window.location='detail.html?detail_id='+detail+'&fic_id='+this.fic_id
        },
         detail:function (nav_id) {
            window.location = 'index.html?nav_id='+nav_id
        }






    }
})